<?php
    set_time_limit(10);
    echo "开始<br>";
    $et = new COM("ET.Application"); 
    echo "打开COM接口<br>";
    $path_parts=pathinfo(__FILE__);
    $dir=$path_parts["dirname"]."\\";
    $src_filename = $dir."1.xls";  //源文件，et或者xls都可以
    $dest_filename = $dir."1.new.xls"; //另存为的文件名
    $pdf_filename = $dir."1.xls.pdf"; //欲转PDF的文件名

    $wb = $et->Workbooks->Open($src_filename);
    echo "成功打开文件<br>";
    //echo "输出文件中数据".$wb->Path."<br>";
    $wb->SaveAs($dest_filename);
    echo "另存为操作<br>";
    $wb->exportpdf($pdf_filename);
    echo "转成PDF<br>";
    $wb->Close(); 
    echo "关闭WorkBooks<br>"; 
    $et->Quit();  
    echo "关闭COM<br>";
    unset( $wb , $et );
    echo "回收资源<br>";
?>
